<?php
// merge js files
include('../appg/settings.php');
include('../appg/init_packer.php');

$Pack->Extension = 'js';
$Pack->Type = 'text/javascript';
$Pack->Path = dirname(__FILE__) . '/cache/';
$Pack->GetPropertyFromRequest();	//Get the index of the files to merge

//Check the requested pack is not already in the cache
if($PackManager->IsCached($Pack)) {
	//Not modified
	$PackManager->SetHeader($Pack, 0);
} else {
	//the requested package is already pack
	$Ispacked = $PackManager->IsPacked($Pack);
	if ($Ispacked == 1){
		$PackManager->GetContentFromCache($Pack);
		$PackManager->ServePack($Pack);
		$PackManager->SetHeader($Pack);
	} elseif ($Ispacked == 0) {
		$PackManager->GetContentFromFiles($Pack);
		$PackManager->ServePack($Pack);
		$PackManager->SetHeader($Pack);
	} else {
		header($_SERVER["SERVER_PROTOCOL"] .' 204 No Content');
	}
}
$Context->Unload();
exit;

?>